﻿package frEngine.loaders.particleSub
{

    public class ParticleRandomObject extends Object
    {
        private var orgSeed:uint;
        private var seed:uint;
        public var randomArr:Array;
        private static const MAX_RATIO:Number = 2.32831e-010;

        public function ParticleRandomObject(param1:uint)
        {
            this.randomArr = new Array();
            var _loc_2:* = param1;
            this.orgSeed = param1;
            this.seed = _loc_2;
            return;
        }// end function

        public function reSetSeed(param1:uint) : void
        {
            var _loc_2:* = param1;
            this.orgSeed = param1;
            this.seed = _loc_2;
            return;
        }// end function

        public function reInitMaxLen(param1:uint) : void
        {
            var _loc_2:* = param1 - this.randomArr.length;
            if (_loc_2 <= 0)
            {
                return;
            }
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2)
            {
                
                this.randomArr.push(this.getNext());
                _loc_3++;
            }
            return;
        }// end function

        public function getNext() : Number
        {
            if (this.orgSeed == 0)
            {
                return Math.random();
            }
            this.seed = this.seed ^ this.seed << 21;
            this.seed = this.seed ^ this.seed >>> 35;
            this.seed = this.seed ^ this.seed << 4;
            return this.seed * MAX_RATIO;
        }// end function

    }
}
